﻿using github.heerheer.card2.UI.Infos;
using System;
using System.Windows;

namespace github.heerheer.card2.UI.Pages
{
    /// <summary>
    /// NoticeView.xaml 的交互逻辑
    /// </summary>
    public partial class NoticeView : Window
    {
        public NoticeView(NewsInfo info)
        {
            InitializeComponent();
            Title.Content = info.Title;
            WebB.NavigateToString(ConvertExtendedASCII(info.Message));
        }
        private static string ConvertExtendedASCII(string HTML)
        {
            string retVal = "";
            char[] s = HTML.ToCharArray();

            foreach (char c in s)
            {
                if (Convert.ToInt32(c) > 127)
                    retVal += "&#" + Convert.ToInt32(c) + ";";
                else
                    retVal += c;
            }

            return retVal;
        }
        private void Btn_OK(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
